
import {DECREASE,INCREASE} from './reducers-type';
import {combineReducers} from 'redux';
/**
 * 包含多个reduce函数（根据老大state和action返回一个新的state）
 * @param {*} state 
 * @param {*} action 
 */
/**
 * 当有多个reducer时 ，通过combineReducers整个reducer
 * function钱的export去掉
 */
function countor(state=0, action){
    switch(action.type){
        case INCREASE:
            return state*1 + action.data*1;
        case DECREASE:
            return state*1 - action.data*1;
        default:
            return state;
    }
}

function countor1(state=0, action){
    switch(action.type){
        case INCREASE:
            return state*1 + action.data*1;
        case DECREASE:
            return state*1 - action.data*1;
        default:
            return state;
    }
}

export default combineReducers({
    countor,
    countor1
})

//redux向外暴露的是什么结构
// {countor:1.countor1:2}